<template>
    <div id="app">
        <div id="logo">

            <div class="info">
                <img src="../assets/img/logo.png" alt="">
                <div>
                    <span>融销通</span>
                    <span>农产品融销一体平台</span>
                </div>
            </div>

            <div>
                <span @click="login">登录</span> | 注册
            </div>

        </div>
        <el-container>
            <el-header>
                <!--菜单-->
                <el-menu :default-active="activeIndex" class="el-menu-demo menu" mode="horizontal"
                    @select="handleSelect" background-color="#668D2F" text-color="#FFFFFF" active-text-color="#FFFFFF">
                    <el-menu-item index="1">首页</el-menu-item>
                    <el-menu-item index="2">商品货源</el-menu-item>
                    <el-menu-item index="3">求购需求</el-menu-item>
                    <el-menu-item index="4">农业知识</el-menu-item>
                    <el-menu-item index="5">专家指导</el-menu-item>
                    <el-menu-item index="6">购物车</el-menu-item>

                    <el-submenu index="7">
                        <template slot="title">融资申请</template>
                        <el-menu-item index="7-1">选项1</el-menu-item>
                        <el-menu-item index="7-2">选项2</el-menu-item>
                        <el-menu-item index="7-3">选项3</el-menu-item>
                    </el-submenu>

                    <el-submenu index="8" v-if="setisVisible">
                        <template slot="title" v-if="setisVisible">设置</template>
                        <el-menu-item index="8-1">选项1</el-menu-item>
                        <el-menu-item index="8-2">选项2</el-menu-item>
                        <el-menu-item index="8-3">选项3</el-menu-item>
                    </el-submenu>

                </el-menu>
            </el-header>
            <el-main>Main</el-main>
        </el-container>
    </div>
</template>

<script>
export default {
    data() {
        return {
            activeIndex: '1',
            activeIndex2: '1',
            setisVisible: false
        };
    },
    methods: {
        handleSelect(key, keyPath) {
            console.log(key, keyPath);
        },
        login() {
            this.$router.push("/login")
        }
    }

}
</script>

<style lang="scss">
#app {
    padding-top: 1px;
}

.el-header {
    background-color: #668D2F;
    color: #333;
    //text-align: center;
    display: flex;
    justify-content: center;
    line-height: 60px;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 660px;
}

body>.el-container {
    margin-bottom: 40px;
}

body {
    padding: 0;
    margin: 0;
}

#logo {
    background-color: #E9EEF3;
    color: green;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 40px;
    padding-right: 40px;

    img {
        width: 50px;
        height: 50px;
        border-radius: 50% 50%;
        margin-right: 5px;
    }

    .info {
        width: 300px;
        height: 50px;
        display: flex;

        div {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding-top: 3px;
            padding-bottom: 2px;
            box-sizing: border-box;

            span:nth-child(1) {
                font-size: 15px;
                font-weight: 600;
            }

            span:nth-child(2) {
                font-size: 12px;
                color: #6f7b8a;

            }
        }
    }
}

.menu {
    background-color: transparent;
    padding-left: 200px;
    padding-right: 200px;
    width: 1000px;
    text-align: center;

    display: flex;
    justify-content: center;
    /* 水平居中 */
    gap: 30px;
    /* 菜单项之间的间距 */
}
</style>
